# 3.一年一度的校园好声音进行到了激烈的决赛环节，8位评委对入围的6名选手给出了最终的评分，请根据评分表，将每位选手的得分去掉一个最高分和一个最低分后求平均分，并按照平均分由高到低的顺序输出选手编号和最后得分
dic_score={ '012':[90,94,85,54,68,75,71,21],
            '005':[8,75,21,65,89,97,25,75],
            '108':[87,54,78,25,14,98,67,57],
            '037':[45,87,54,82,95,91,57,32],
            '066':[95,67,51,48,98,92,80,39],
            '020':[85,81,65,97,35,62,71,84]}
final_score={}
for k,v in dic_score.items():
    v_max = max(v)
    v_min = min(v)
    v_sum = sum(v)
    v_avg = (v_sum - v_max - v_min)/(len(v) - 2)

    final_score[k] = v_avg

print(final_score)

lt_avg=[(v,k)  for  k,v  in  final_score.items()]
lt_avg.sort(reverse=True)
lt_avg=dict(lt_avg)

#输出结果
for k,v in lt_avg.items():
    print(k,v)